<?php

class Admin_Form_Event_Add extends My_FormAdmin {

    public function init() {
        parent::init();
        $this->setMethod('post');
        $this->setAction($this->getView()->url(array('controller' => 'event', 'action' => 'save'), 'admin', true));

        $this->setTitle($this->translate('XXX_ADMIN_EVENT_ADD_FORM_TITLE'));
        
        $daoEvent= new Application_Model_DAO_Event();
        
        $info = new Zend_Form_Element_Select('event_info_id');
        $info->setLabel(_('XXX_ADMIN_EVENT_SELECT_FORM_SELECT_INFO_LABEL'));
        $info->setRequired();
        $options = array(
            '' => '',
        );
        foreach($daoEvent->getAllInfos()->query()->fetchAll() as $row) {
            $options[$row['event_info_id']] = $row['name'];
        }
        $info->setMultiOptions($options);
        $this->addElement($info);
        
        $place = new Zend_Form_Element_Select('event_place_id');
        $place->setLabel(_('XXX_ADMIN_EVENT_FORM_SELECT_PLACE_LABEL'));
        $place->setRequired();
        $options = array(
            '' => '',
        );
        foreach($daoEvent->getAllPlaces()->query()->fetchAll() as $row) {
            $options[$row['event_place_id']] = $row['name'];
        }
        $place->setMultiOptions($options);
        $this->addElement($place);
        
        $name = new Zend_Form_Element_Text('start_date');
        $name->setLabel(_('XXX_ADMIN_EVENT_FORM_START_DATE_LABEL'));
        $name->setRequired();
        $this->addElement($name);
        
        $name = new Zend_Form_Element_Text('start_time');
        $name->setLabel(_('XXX_ADMIN_EVENT_FORM_START_TIME_LABEL'));
        $this->addElement($name);
        
        $name = new Zend_Form_Element_Text('end_date');
        $name->setLabel(_('XXX_ADMIN_EVENT_FORM_END_DATE_LABEL'));
        $this->addElement($name);
        
        $name = new Zend_Form_Element_Text('end_time');
        $name->setLabel(_('XXX_ADMIN_EVENT_FORM_END_TIME_LABEL'));
        $this->addElement($name);
        

        $this->addSubmitElement();

    }

}

